<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php if(empty($post)): ?> Blog <?php else: ?> <?php echo e($post->title); ?> <?php endif; ?></title>
    <meta name="keyword" content="vue,webpack,blog,laravel,markdown">
    <meta name="description" content="<?php if(empty($post)): ?>   <?php else: ?> <?php echo e($post->description); ?> <?php endif; ?>">
    <link rel="stylesheet" href="/static/css/layouts/pure-min.css">
        <!--[if lte IE 8]>
            <link rel="stylesheet" href="/static/css/layouts/email-old-ie.css">
        <![endif]-->
        <!--[if gt IE 8]><!-->
            <link rel="stylesheet" href="/static/css/layouts/email.css">
        <!--<![endif]-->
</head>
<body>

<div id="layout" class="content pure-g">
    <div id="nav" class="pure-u">
        <a href="#" class="nav-menu-button">Menu</a>

        <div class="nav-inner">
            <a class="primary-button pure-button" href="/writer#/">写文章</a>

            <div class="pure-menu">
                <ul class="pure-menu-list">
                    <?php if(auth()->guard()->guest()): ?>

                    <?php else: ?>
                    <li class="pure-menu-item"><a class="pure-menu-link" href="<?php echo e(route('logout')); ?>"
                                       onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                        <?php echo e(__('Logout')); ?> <span class="email-count">(<?php echo e(Auth::user()->name); ?>)</span>
                                    </a>

                                    <form id="logout-form" action="<?php echo e(route('logout')); ?>" method="POST" style="display: none;">
                                        <?php echo csrf_field(); ?>
                                    </form></li>                    
                    <?php endif; ?>
                    <li class="pure-menu-heading">Category</li>
                    <?php if(isset($categories)): ?>
                         <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat_item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li class="pure-menu-item"><a href="?cat=<?php echo e($cat_item->id); ?>" class="pure-menu-link"><?php echo e($cat_item->name); ?></a></li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
    </div>

    <div id="list" class="pure-u-1">

        <?php $__currentLoopData = $posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="email-item <?php if($loop->index%2==1): ?> email-item-selected <?php else: ?> email-item-unread <?php endif; ?> pure-g">
            <div class="pure-u-1">                
                <h4 class="email-subject"><a href="?id=<?php echo e($item->id); ?>"><?php echo e($item->title); ?></a></h4>
                <p class="email-desc">
                    <?php echo e($item->description); ?>

                </p>
                <h5 class="email-name"><?php echo e($item->category->name); ?></h5>
            </div>
        </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

        
    <?php if(isset($cat)): ?>
        <?php echo e($posts->appends(['cat' => $cat ])->links('vendor.pagination.bootstrap-4')); ?>

    <?php else: ?>
        <?php echo e($posts->links('vendor.pagination.bootstrap-4')); ?>

    <?php endif; ?>
    </div>

    <div id="main" class="pure-u-1">
        <?php if(empty($post)): ?>
        <?php else: ?>
        <div class="email-content">
            <div class="email-content-header pure-g">
                <div class="pure-u-1">
                    <h1 class="email-content-title"><?php echo e($post->title); ?></h1>
                    <p class="email-content-subtitle">
                        <a><?php echo e($post->user->name); ?></a> 发布于 <span><?php echo e($post->category->name); ?></span> 更新日期: <span><?php echo e($post->updated_at); ?></span>  


                        <?php if(auth()->guard()->check()): ?>  
                          <?php if(Auth::user()->id==$post->user->id): ?>
                            <a href="/writer#/article/<?php echo e($post->id); ?>">编辑</a>  
                          <?php endif; ?>
                        <?php endif; ?>  
                    </p>
                </div>

              
            </div>

            <div class="email-content-body">
                <?php echo $post->html; ?>

            </div>
        </div>
        <?php endif; ?>
    </div>
</div>
<script src="https://cdn.bootcss.com/yui/3.18.1/yui/yui-min.js"></script>
<link href="https://cdn.bootcss.com/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
    YUI().use('node-base', 'node-event-delegate', function (Y) {

        var menuButton = Y.one('.nav-menu-button'),
            nav        = Y.one('#nav');

        // Setting the active class name expands the menu vertically on small screens.
        menuButton.on('click', function (e) {
            nav.toggleClass('active');
        });

        // Your application code goes here...

    });
</script>




</body>
</html>